package com.jin.model;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@Entity
@Getter
@Setter
@Where(clause = "delete_time is null")
public class Coupon extends BaseEntity {
    @Id
    private Long id;
    private Integer activityId;
    private String title;
    //可以使用的起始时间
    private Date startTime;
    //可以使用的结束时间
    private Date endTime;
    private String description;
    //用于满减券 满一千减五百 一千就是fullMoney(满的部分)
    private BigDecimal fullMoney;
    //满减券减的部分
    private BigDecimal minus;
    //折扣
    private BigDecimal rate;
    //对于优惠券的说明
    private String remark;
    //表示当前的优惠券是不是一张全场券
    private Boolean wholeStore;
    //优惠券的类型
    private Integer type;

    //与分类表是双向多对多的关系，双方都需要互相的数据
    @ManyToMany(fetch = FetchType.LAZY,mappedBy = "couponList")
    private List<Category> categoryList;



}
